package io低级流or节点流;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class Test02 {
    public static void main(String[] args) throws IOException {
        Scanner scanner = new Scanner(System.in);

        while (true){

            System.out.println("请输入字符");
            String next = scanner.next();
            File file = new File("./src/io/note.txt");
            if ("exit".equals(next)){
                System.out.println("退出");
                break;
            }

            FileOutputStream fol = new FileOutputStream(file,true);
            byte[] bytes = next.getBytes(StandardCharsets.UTF_8);
            fol.write(bytes);

            fol.close();
        }
        System.out.println("关闭程序");


    }
}
